/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx.oop;

import java.util.Random;

/**
 * <p>Project: jse2303 - C2
 * <p>Powered by webrx On 2023-07-13 11:07:38
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class C2 {

    //... 是变相的数组
    public static int sum(int... n) {
        int sum = 0;
        for (int t : n) {
            sum += t;
        }
        return sum;
    }

    public static int max(int... n) {
        int max = 0;
        if (n.length > 0) {
            max = n[0];
        }
        for (int t : n) {
            max = Math.max(max, t);
        }
        return max;
    }


    public static int sums(int[] n) {
        int sum = 0;
        for (int t : n) {
            sum += t;
        }
        return sum;

    }

    public int[] getNums(int len) {
        int[] tt = new int[len];
        Random rand = new Random();
        for (int i = 0; i < len; i++) {
            tt[i] = rand.nextInt(1, 101);
        }
        return tt;
    }


    public static void main(String... args) {
        System.out.println(max(3, 4, 5) == 0 ? "null" : max(3, 4, 5));

        //System.out.println(sum());
        //System.out.println(sum(10));
        //System.out.println(sum(10, 15));
        //System.out.println(sum(2, 4, -6, 90, 22, 15, 0, 3, -10));
        //
        //
        //int[] nnn = {1, 2, 3};
        //System.out.println(sums(nnn));
        //
        //var cc = new C2();
        //System.out.println(Arrays.toString(cc.getNums(10)));
    }
}
